<?php

/**
 * TrabajoRealizar form base class.
 *
 * @method TrabajoRealizar getObject() Returns the current form's model object
 *
 * @package    zing
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTrabajoRealizarForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'idTrabajo'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Trabajo'), 'add_empty' => false)),
      'idEmpleado'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Empleado'), 'add_empty' => true)),
      'idPedidoProducto'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PedidoProducto'), 'add_empty' => false)),
      'cantidad'           => new sfWidgetFormInputText(),
      'tiempoRealHoras'    => new sfWidgetFormInputText(),
      'realizado'          => new sfWidgetFormInputCheckbox(),
      'fechaEntrega'       => new sfWidgetFormDateTime(),
      'idTrabajoPrevio'    => new sfWidgetFormInputText(),
      'idTrabajoPosterior' => new sfWidgetFormInputText(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'idTrabajo'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Trabajo'))),
      'idEmpleado'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Empleado'), 'required' => false)),
      'idPedidoProducto'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('PedidoProducto'))),
      'cantidad'           => new sfValidatorInteger(),
      'tiempoRealHoras'    => new sfValidatorString(array('max_length' => 10)),
      'realizado'          => new sfValidatorBoolean(array('required' => false)),
      'fechaEntrega'       => new sfValidatorDateTime(array('required' => false)),
      'idTrabajoPrevio'    => new sfValidatorInteger(array('required' => false)),
      'idTrabajoPosterior' => new sfValidatorInteger(array('required' => false)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('trabajo_realizar[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TrabajoRealizar';
  }

}
